const fs = require('fs')
const path = require('path')

class StaticFile {
    findImg(ctx) {
        const filePath = path.join(__dirname, '../static/img/1.jpeg')
        ctx.body = fs.createReadStream(filePath)
    }

    saveImg(ctx) {
        const filename = path.basename(ctx.request.files.file.path)
        ctx.body = `${ctx.app.state.address}/${filename}`
    }
}

export default new StaticFile()
